#include <iostream>
#include <cstdio>
#include <cstdint>
#include <unistd.h>
#include <sys/eventfd.h>

int main()
{
	int ret = ::eventfd(0,EFD_CLOEXEC | EFD_NONBLOCK);
	if(ret < 0)
	{
		perror("eventfd error");
		return -1;
	}
	uint64_t val = 1;
	::write(ret,&val,sizeof(val));
	::write(ret,&val,sizeof(val));
	::write(ret,&val,sizeof(val));
	::write(ret,&val,sizeof(val));
	::write(ret,&val,sizeof(val));
	uint64_t cal = 1;
	::read(ret,&cal,sizeof(cal));
	std::cout << cal << std::endl;
	return 0;
}